<template>
  <TableView
    ref="tableView"
    :table-attrs="{ api: getPage, descs: ['create_time'],
                    dicOptions: [
                      { prop: 'status', dicType: 'inventorytask_status' },
                      { prop: 'type', dicType: 'inventorytask_type' }
                    ] }"
    form-path="/inventory/InventoryTaskForm/{id:-1}"
    :search-model="searchForm"
    :delete-api="batchDelete"
    :toolbar-attrs="{ buttons: ['slot', { del: 'inventory_inventorytask_del', create: 'inventory_inventorytask_add' }] }">
    <template #toolbar-button="{ selectedRows }">
      <!-- 自定义按钮 -->
    </template>
    <template #columns>
      <TableColumn label="状态" prop="status" width="80"/>
      <TableColumn label="排序号" prop="orderNo" width="80"/>
      <TableColumn label="类型" prop="type" width="80"/>
      <TableColumn label="名称" prop="subject"/>
      <TableColumn label="开始时间" prop="startTime" width="145"/>
      <TableColumn label="结束时间" prop="endTime" width="145"/>
      <TableColumn label="创建时间" prop="createTime" width="145"/>
      <TableColumn label="创建人" prop="createBy" width="120"/>
      <TableColumn label="说明" prop="description"/>
    </template>
    <template #search-form>
      <!-- 搜索条件 -->
    </template>
  </TableView>
</template>

<script>
  import { mapState } from 'vuex'
  import { services } from '@/config'
  import { getPage, batchDelete } from '@/api/inventory/inventoryTask'

  export default {
    name: 'InventoryTask',
    data() {
      return {
        searchForm: {
          createBy: '',
          createTime: '',
          subject: '',
          startTime: '',
          endTime: '',
          status: '',
          type: '',
          description: ''
        }
      }
    },
    computed: {
      services() {
        return services
      },
      ...mapState('user', ['permissions'])
    },
    methods: {
      getPage,
      batchDelete,
      //  导出excel
      exportExcel() {
        this.$downBlobFile(`${services.assetService}inventorytask/export`, this.searchForm, 'inventory.xlsx')
      }
    }
  }
</script>
